package Thread;

public class ThreadDemo24 {
    public static void main(String[] args) throws InterruptedException {
        //wait:1、释放锁
        //2、阻塞等待
        //3、当其他线程调用notify时，重新获取到锁
        Object object = new Object();
        synchronized (object){
            System.out.println("wait之前：");
            object.wait();//有锁才能使用wait,锁对象必须和调用wait的对象相同，其他线程调用notify也必须是当前对象
            System.out.println("wait之后：");
        }
    }
}
